<?php

namespace app\admin\model;

use app\admin\service\Rbac;

class PermissionCategory extends \app\common\model\PermissionCategory
{
    public static function getList($where)
    {
        $rbac = new Rbac();
        $return = $rbac->getPermissionCategory($where);

        foreach ($return['data'] as $key => $value){
            $return['data'][$key]['create_time'] = get_datetime($value['create_time']);
            $return['data'][$key]['status'] = self::attributes('status', $value['status']);
        }
        return [
            'model' => $return['data'],
            'count' => count($return['data'])
        ];
    }

    public static function saveOne($data)
    {
        $rbac = new Rbac();
        return $rbac->savePermissionCategory($data);
    }

    public static function deleteOne($ids)
    {
        $rbac = new Rbac();
        return $rbac->delPermissionCategory($ids);
    }
}